package com.ck.demo;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Recursive {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        getPathString("E:\\_ck\\study\\面试专题课程笔记源码",list);

        for(String s : list){
            System.out.println(s);
        }
    }

    private static void getPathString(String url, List<String>paths){
        File filePath = new File(url);

        File[] files = filePath.listFiles();
        if(files == null){
            return;
        }
        for(File f : files){
            paths.add(f.getPath());
            if(f.isDirectory()){
                getPathString(f.getPath(),paths);
            }
        }
        Collections.synchronizedList(new ArrayList<>());

    }
}
